<?php

namespace app\common\controller;

class ErrorCode
{
    /**
     * @const   Validate Error Code
     */
    const ILLEGAL_REQUEST_TYPE         = 500; //非法请求方式 (比如,非ajax)
    const ACCOUNT_OR_PASSWORD_ERROR    = 501; //用户账号或密码错误
    const ACCOUNT_IS_EMPTY             = 502; //用户账号为空
    const PASSWORD_IS_EMPTY            = 503; //用户密码为空
    const USER_HAS_NOT_LOGGED_IN       = 504; //用户未登录
    const USER_HAS_NOT_BEEN_AUTHORIZED = 505; //用户未授权
    const ACCOUNT_IS_BANNED            = 506; //用户账号被锁定
    const SIGN_DOES_NOT_MATCH          = 507; //验签失败
    const VERIFICATION_CODE_INCORRECT  = 508; //验证码不正确
    const PARAMETER_ERROR              = 509; //参数错误
    /**
     * @const   操作错误码
     */
    const SUCCESS             = 1000; //操作成功
    const DATA_LOADING_FAILED = 1001; //数据加载失败
    const OPERATION_FAILED    = 1002; //数据操作失败
    const DATA_DOES_NOT_EXIT  = 1003; //数据不存在
    /**
     * @const   Curl Error Code
     */
    const CURL_REQUEST_FALLED = 2000; //CURL 请求失败

    /**
     * @var 常用错误码
     */
    public static $code = [
        '500'                                                       => '非法请求方式',
        '501'                                                       => '用户账号或密码错误',
        '502'                                                       => '用户账号为空',
        '503'                                                       => '用户密码为空',
        '504'                                                       => '用户未登录',
        '505'                                                       => '用户未授权',
        '506'                                                       => '账号被锁定,联系管理员',
        '507'                                                       => '验签失败',
        '508'                                                       => '验证码不正确',
        '509'                                                       => '参数错误,参数不完整或类型不正确',

        '1000'                                                      => '操作成功',
        '1001'                                                      => '数据加载失败',
        '1002'                                                      => '数据操作失败',
        '1003'                                                      => '数据不存在',

        '2000'                                                      => 'CURL 请求失败',

        // Validate Error Message
        ':attribute require'                                        => ':attribute不能为空',
        ':attribute must be numeric'                                => ':attribute必须是数字',
        ':attribute must be integer'                                => ':attribute必须是整数',
        ':attribute must be float'                                  => ':attribute必须是浮点数',
        ':attribute must be bool'                                   => ':attribute必须是布尔值',
        ':attribute not a valid email address'                      => ':attribute格式不符',
        ':attribute not a valid mobile'                             => ':attribute格式不符',
        ':attribute must be a array'                                => ':attribute必须是数组',
        ':attribute must be yes,on or 1'                            => ':attribute必须是yes、on或者1',
        ':attribute not a valid datetime'                           => ':attribute不是一个有效的日期或时间格式',
        ':attribute not a valid file'                               => ':attribute不是有效的上传文件',
        ':attribute not a valid image'                              => ':attribute不是有效的图像文件',
        ':attribute must be alpha'                                  => ':attribute只能是字母',
        ':attribute must be alpha-numeric'                          => ':attribute只能是字母和数字',
        ':attribute must be alpha-numeric, dash, underscore'        => ':attribute只能是字母、数字和下划线_及破折号-',
        ':attribute not a valid domain or ip'                       => ':attribute不是有效的域名或者IP',
        ':attribute must be chinese'                                => ':attribute只能是汉字',
        ':attribute must be chinese or alpha'                       => ':attribute只能是汉字、字母',
        ':attribute must be chinese,alpha-numeric'                  => ':attribute只能是汉字、字母和数字',
        ':attribute must be chinese,alpha-numeric,underscore, dash' => ':attribute只能是汉字、字母、数字和下划线_及破折号-',
        ':attribute not a valid url'                                => ':attribute不是有效的URL地址',
        ':attribute not a valid ip'                                 => ':attribute不是有效的IP地址',
        ':attribute must be dateFormat of :rule'                    => ':attribute必须使用日期格式 :rule',
        ':attribute must be in :rule'                               => ':attribute必须在 :rule 范围内',
        ':attribute be notin :rule'                                 => ':attribute不能在 :rule 范围内',
        ':attribute must between :1 - :2'                           => ':attribute只能在 :1 - :2 之间',
        ':attribute not between :1 - :2'                            => ':attribute不能在 :1 - :2 之间',
        'size of :attribute must be :rule'                          => ':attribute长度不符合要求 :rule',
        'max size of :attribute must be :rule'                      => ':attribute长度不能超过 :rule',
        'min size of :attribute must be :rule'                      => ':attribute长度不能小于 :rule',
        ':attribute cannot be less than :rule'                      => ':attribute日期不能小于 :rule',
        ':attribute cannot exceed :rule'                            => ':attribute日期不能超过 :rule',
        ':attribute not within :rule'                               => '不在有效期内 :rule',
        'access IP is not allowed'                                  => '不允许的IP访问',
        'access IP denied'                                          => '禁止的IP访问',
        ':attribute out of accord with :2'                          => ':attribute和确认字段:2不一致',
        ':attribute cannot be same with :2'                         => ':attribute和比较字段:2不能相同',
        ':attribute must greater than or equal :rule'               => ':attribute必须大于等于 :rule',
        ':attribute must greater than :rule'                        => ':attribute必须大于 :rule',
        ':attribute must less than or equal :rule'                  => ':attribute必须小于等于 :rule',
        ':attribute must less than :rule'                           => ':attribute必须小于 :rule',
        ':attribute must equal :rule'                               => ':attribute必须等于 :rule',
        ':attribute has exists'                                     => ':attribute已存在',
        ':attribute not conform to the rules'                       => ':attribute不符合指定规则',
        'invalid Request method'                                    => '无效的请求类型',
        'invalid token'                                             => '令牌数据无效',
        'not conform to the rules'                                  => '规则错误',
    ];
}
